<?php defined('BASEPATH') || exit('No direct script access allowed');

/**
 * Building controller
 */
class Home extends Api_Controller
{
    /**
     *  @apiDefine Home 首页
     */
    function __construct()
    {
        // Construct the parent class
        parent::__construct();
        $this->load->model('indexButton_m');
    }

    /**
     * @api               {get} home/index 首页菜单
     * @apiGroup          Home
     * @apiName           home/index
     * @apiVersion        1.0.0
     * @apiDescription    首页菜单
     * @apiSampleRequest https://api.bjxpel.cn/api/home/index
     * @apiSuccess {String}  title 标题
     * @apiSuccess {String}   url 外链
     * @apiSuccessExample 成功响应
     *          {
     *           "message": "ok",
     *           "code": 200,
     *           "data": null
     *          }
     * @apiErrorExample   失败响应
     *            {
     *             "message": "err",
     *             "code": 0,
     *             "data": null
     *            }
     */
    public function index()
    {
        $button = $this->indexButton_m->select([], 4);
        if (!$button) {
            return $this->failure();
        }
        return $this->success(['list' => $button]);
    }

}